//service的统一出口
import DLRequest from "./request";
import { BASE_URL, BASE_OUT } from "./request/config";
import localCache from "@/utils/cache";
//创建其中的一个实例
const dlRequest = new DLRequest({
  baseURL: BASE_URL,
  timeout: BASE_OUT,
  interceptors: {
    requestInterceptor: (config) => {
      const token = localCache.getCache("token");
      if (token) {
        config.headers!.Authorization = token; //携带token的拦截
      }
      return config;
    },
    requestInterceptorCatch: (err) => {
      console.log(err);
    },
  },
  showloading: true,
});
export default dlRequest;
